globalThis.NS_CONFIG = {}
// 融合通信
NS_CONFIG.RH_IP = '192.168.100.207'
NS_CONFIG.RH_IP_PORT = '11080' 
// 视频最大链路数
NS_CONFIG.RH_LINKS_MAX_NUM = 16
// 语音最大链路数
NS_CONFIG.RH_YY_LINKS_MAX_NUM = 128

NS_CONFIG.RH_ROOM_NAME = 'yjcz001'
NS_CONFIG.RH_ROOM_NUMBER = '12345'
//console.log('globalThis.NS_CONFIG:::', NS_CONFIG, 'window.__UNI_ENV__:::', window.__UNI_ENV__)

// boxim
NS_CONFIG.IM_TARGET_ID = 21;
NS_CONFIG.MAX_MESSAGE_SIZE = 3000;
// 开发环境
NS_CONFIG.BASE_URL = "/imApi";
NS_CONFIG.WS_URL = "ws://192.168.100.205:8878/im";
// 生产环境
// NS_CONFIG.BASE_URL = "http://192.168.100.205:8888/imApi";
// NS_CONFIG.WS_URL = "ws://192.168.100.205:8878/im";

NS_CONFIG.EVENT_NAMES = {
	nsCallVm: 'nsCallVm',
	nsCallGcmItemPane: 'nsCallGcmItemPane',
	nsCallGcmGetMembers: 'nsCallGcmGetMembers',
	nsCallVmOnlyLink: 'nsCallVmOnlyLink'
} 
NS_CONFIG.EVENT_BUS = (function() {
  // 私有变量
  var events = {};

  return {
    $on: function(event, callback) {
      if (!events[event]) {
        events[event] = [];
      }
      events[event].push(callback);
    },
    
    $emit: function(event, data) {
		console.log('event:', event, 'data:', data, events)
      if (events[event]) {
        events[event].forEach(function(callback) {
          callback(data);
        });
      }
    },
    
    $off: function(event, callback) {
      if (events[event]) {
        var index = events[event].indexOf(callback);
        if (index !== -1) {
          events[event].splice(index, 1);
        }
      }
    }
  };
})();